1. Home
  2. Java
  3. Variables and Datatypes

Variables and Datatypes

Java – Variables and Datatypes

A programming language is designed to process data. The function of processing data is accomplished by executing a sequence of instructions constituting a program. An instruction is formed by using certain symbols and words according to the syntax rules of the language. Java is also a programming language; therefore, it has its vocabulary and grammar.

In this topic, we will discuss tokens, constants, variables and data types related to the Java language.

Java Character Set

Java is written in UNICODE a 16-bit character coding systems and currently supports more than 34,000 defined characters derived from America, Europe, Middle East, Africa and Asia (Including India). The first 256 characters of UNICODE are the ISO Latin 1 character set, and first 128 characters of Latin 1 are equivalent to the 7 bit ASCII character set.

Generally, the ASCII character set (which is a subset of UNICODE) will be used in developing the programs.

Unicode is a universal international standard character encoding that is capable of characterizing most of the world’s written languages.

Why Java uses Unicode System?

Before Unicode, there were many language standards like ASCII, EBCDIC, etc.

This caused two problems:

1. A particular code value corresponds to different letters in distinct language standards.
2. The encoding for languages with large characters sets has a variable length. Some various characters are encoded as single bytes; others require two or more byte.

To solve these problems, a new language standard was established i.e., Unicode
System.

In Unicode, the character holds 2 bytes, so Java uses 2 bytes for characters.

Lowest value: \u0000
Highest value: \uFFFF

Articles

Tags